{% extends "base.html" %}
{% load event_tags %}
{% block content %}
    {{ block.super }}
    <h3> Close a Finding</h3>
    <h4>{{ finding.title }}</h4>
    {% if note_types|length <= 1 %}
      <p>Please provide a reason why this finding is being closed.</p>
    {% elif note_types|length > 1 %}
      <p>Please add atleast one note from the following note type(s):</p>
      {% for note_type in note_types %}
        {{ note_type.name}}<br>
      {% endfor %}
    {% endif %}
    <form class="form-horizontal" action="{% url 'close_finding' finding.id %}" method="post">
        {% csrf_token %}
        {% include "dojo/form_fields.html" with form=form %}
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
              {% if note_types|length <= 1 %}
                <input class="btn btn-primary" name='submit' type="submit" value="Close Finding" aria-label="Close Finding"/>
              {% elif note_types|length > 1 %}
                <input class="btn btn-primary" name='submit' type="submit" value="Add Note" aria-label="Add Note"/>
              {% endif %}
            </div>
        </div>
    </form>
{% endblock %}
